<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/animate.js"></script>
    <style>
        * {
            margin: 0 auto;
        }
        .box {
            width: 100%;
            height: 100px;
            position: relative;
        }
        
        .spa {
            background-color: purple;
            height: 100px;
            width: 100px;
            position: absolute;
            right: 0px;
            z-index: 9999;
        }
        .tip {
            left: 881px;
            position: absolute;
            color: white;
            background-color: peachpuff;
            height: 100px;
            width: 300px;
        }
    </style>
</head>
<body>
    <div class="box">
        <span class="spa"><-</span>
        <div class="tip">弹出tip</div>
    </div>
    <script>
        var tip = document.querySelector('.tip');
        var spa = document.querySelector('.spa');
        spa.addEventListener('mouseenter', function() {
            animate(tip, 581);
        })
        spa.addEventListener('mouseleave', function() {
            animate(tip, 881)
        })
    </script>
</body>
</html>